using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace Umdf.ComInterop
{
    static class SideShowEvents
    {
        public const string GUID_DEVINTERFACE_SIDESHOW = "152E5811-FEB9-4B00-90F4-D32947AE1681";
        public const string SIDESHOW_CONTENT_MISSING_EVENT = "5007FBA8-D313-439f-BEA2-A50201D3E9A8";
        public const string SIDESHOW_APPLICATION_EVENT = "4CB572FA-1D3B-49b3-A17A-2E6BFF052854";
        public const string SIDESHOW_USER_CHANGE_REQUEST_EVENT = "5009673c-3f7d-4c7e-9971-eaa2e91f1575";

        /// <summary>
        /// This event is posted in response to Content Missing Event on the device.  The
        /// struct contains the parameters that identify which device the event came
        /// from, which application/endpoint it is for, and the content id of the
        /// requested content.
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct CONTENT_MISSING_EVENT_DATA
        {
            public uint cbContentMissingEventData;
            public Guid ApplicationId;
            public Guid EndpointId;
            public uint ContentId;
        }

        /// <summary>
        /// This struct contains an event sent by an application on the device.
        /// The data is determined by the application and the event id.  Since
        /// the data can be variable size, we store the size of the data and then
        /// the first byte of it.  This struct should always be allocated as
        /// offsetof(APPLICATION_EVENT_DATA, bEventData) + &lt;event data size&gt;, and this
        /// size should be set in cbApplicationEventData.  The cbEventData
        /// member should contain just &lt;event data size&gt;.
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct APPLICATION_EVENT_DATA
        {
            public uint cbApplicationEventData;
            public Guid ApplicationId;
            public Guid EndpointId;
            public uint EventId;
            public uint cbEventData;
        }

        /// <summary>
        /// This struct contains an event sent by the driver to the platform.  Shared
        /// devices can use this event in their driver to signal to the platform that a
        /// a request for a new user to take ownership of the device has been made.  The
        /// platform will set the current user on the device in response to the message,
        /// and upon success, will notify gadgets as if a device add had taken place.
        /// When posting this event to request that the active user of the device be
        /// changed, drivers should set wszUser to the SID of the user that is the new
        /// requested owner of the device.
        /// </summary>
        [StructLayout(LayoutKind.Sequential)]
        public struct DEVICE_USER_CHANGE_EVENT_DATA
        {
            public uint cbDeviceUserChangeEventData;
            public IntPtr wszUser;
        }

        public enum SCF_EVENT_IDS : uint
        {
            SCF_EVENT_NAVIGATION = 1,
            SCF_EVENT_MENUACTION = 2,
            SCF_EVENT_CONTEXTMENU = 3
        }

        public const uint SIDESHOW_EVENTID_APPLICATION_ENTER = 0xFFFF0000;
        public const uint SIDESHOW_EVENTID_APPLICATION_EXIT = 0xFFFF0001;

        [StructLayout(LayoutKind.Sequential)]
        public struct SCF_CONTEXTMENU_EVENT
        {
            public uint PreviousPage;
            public uint TargetPage;
            public uint PreviousItemId;
            public uint MenuPage;
            public uint MenuItemId;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SCF_MENUACTION_EVENT
        {
            public uint PreviousPage;
            public uint TargetPage;
            public uint Button;
            public uint ItemId;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct SCF_NAVIGATION_EVENT
        {
            public uint PreviousPage;
            public uint TargetPage;
            public uint Button;
        }
    }
}
